﻿//======================================================================
// Copyright (c) 同程网络科技有限公司. All rights reserved.
// 所属项目：请一定在此填写项目，若不清楚，问主管
// 创 建 人：刘稳
// 创建日期：2012-5-31 14:18:45 
// 用    途：请一定在此描述类用途
//====================================================================== 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
using System.Data;


/// <summary> 
/// 作者：刘稳 
/// 时间：2012-5-31 14:18:45 
/// 公司:Copyright (c) 同程网络科技有限公司. All rights reserved. 
/// 版权：2012-2012 
/// CLR版本：4.0.30319.269  
/// 唯一标识：7567c083-3b36-4c4d-bbf2-24fca0d8dc6a 
/// 类的用途：
/// </summary>
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void Data()
    {
        string fliename = Server.MapPath("~/upload/1.xls");
        ExcelHelper helpler = new ExcelHelper(fliename);

        DataTable dt = helpler.TruncateFirstSheetToDataTable();
        //string pram = "msg=<?xml version=\"1.0\" encoding=\"gbk\"?><Result><PID>T12053109501821192188</PID><DATETIME>2012-05-19 22:54:54</DATETIME><MSG>12051922545415960494,OL0000316462</MSG><ERR>成功</ERR></Result>";
        string url = "http://flightadminapi.17usoft.com//Insurance/ReturnInsuranceBackHandler.ashx";
        string result = string.Empty;
        foreach (DataRow dr in dt.Rows)
        {
            string pram = string.Format("msg=<?xml version=\"1.0\" encoding=\"gbk\"?><Result><PID>{0}</PID><DATETIME>{1}</DATETIME><MSG>{2},{3}</MSG><ERR>成功</ERR></Result>", dr[2], dr[3], dr[1], dr[0]);
            result = HttpRequestHelper.GetRequest(pram, url);
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Data();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        string fliename = Server.MapPath("~/upload/1.xls");
        ExcelHelper helpler = new ExcelHelper(fliename);

        DataTable dt = helpler.TruncateFirstSheetToDataTable();
        string pram = "msg=<?xml version=\"1.0\" encoding=\"gbk\"?><Result><PID>T12053109501821192188</PID><DATETIME>2012-05-19 22:54:54</DATETIME><MSG>12051922545415960494,OL0000316462</MSG><ERR>成功</ERR></Result>";
        foreach (DataRow dr in dt.Rows)
        {
            string insSql = string.Format(@"INSERT INTO [demo].[dbo].[one]
                                           ([oneName])
                                     VALUES
                                           ('{0}')", dr[2]);
            DBHelper.ExecuteNonQuery(insSql, DBHelper.DB_DEMO);
        }
    }
}